const baseUrl = 'http://47.100.78.124:9981' //共有路径

export const myRequest = (url, method, data) => {
  return new Promise((resolve, reject) => {
    uni.showLoading({
      title: '加载中'
    });
    const value = uni.getStorageSync("token");
    uni.request({
      url: baseUrl + url,
      method: method || 'GET',
      data: data || {},
      header:{
         Authorization:'Bearer '+value.accessToken,
         // Authorization:'Bearer '+'cf5AjbUL4FSZCXNJDLVD7VfDAVSkch4q3YMpIIEeWruK6Le9B8yEies654py1KvY2LL8jpzgxXPpRQqUcZvM46LD1CGNQxKmEUC7tAzJ321AKa6fzTtwqoSZ8Ui74jjp',
      },
      success: (res) => {
        resolve(res)
      },
      fail: (err) => {
        reject(err)
      },
      complete: () => {
        // 关闭加载中的特效
        uni.hideLoading()
      }
    })
  })
}
